<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>修改收货地址</title>
    <link rel="stylesheet" href="/layui/css/layui.css" />
    <script type="text/javascript" src="/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript" src="/layer/layer.js"></script>
    <script type="text/javascript" src="/layui/layui.js" ></script>
</head>

<body>

<form class="layui-form" action="/editAddress/2" style="width: 650px;margin-top: 20px;">
    <input type="hidden" name="aid" th:value="${willEditAddress.aid}" value="" >
    <div class="layui-form-item">
        <label class="layui-form-label">收件人</label>
        <div class="layui-input-block">
            <input th:value="${willEditAddress.realname}" id="userName" type="text" name="realname" required lay-verify="required" placeholder="请输入姓名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">电话</label>
        <div class="layui-input-block">
            <input th:value="${willEditAddress.mobile}" type="phone" name="mobile" required lay-verify="required" placeholder="请输入电话" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item" >
        <label class="layui-form-label">地区</label>
        <div class="layui-input-block">
            <select name="zone" lay-verify="required">
                <option th:value="${willEditAddress.zone}" value="" th:text="${willEditAddress.zone}"></option>
                <option value="湖北">湖北</option>
                <option value="北京">北京</option>
                <option value="上海">上海</option>
                <option value="广州">广州</option>
                <option value="深圳">深圳</option>
                <option value="杭州">杭州</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">详细地址</label>
        <div class="layui-input-block">
            <textarea name="street" required placeholder="请输入内容" class="layui-textarea" th:text="${willEditAddress.street}"></textarea>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal"  lay-submit lay-filter="formDemo" type="submit">修改</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script>
    //Demo
    layui.use('form', function() {
        var form = layui.form;
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        //监听提交
        form.on('submit(formDemo)', function(data) {
            var val = $("#userName").val();
            parent.layer.msg('收件人 ' +val + ' 修改成功！');
            parent.layer.close(index);
            parent.location.reload();
        });
    });
</script>

</body>
</html>